//
//  BRTest.m
//  propertyDemo
//
//  Created by apple on 16/12/21.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "BRTest.h"

@interface BRTest()<NSCopying,NSMutableCopying>

@end

@implementation BRTest

@synthesize name = _name;

- (void)setName:(NSString *)name{
    _name = name;
}
- (NSString *)name{
    return _name;
}

- (id)copyWithZone:(NSZone *)zone{
    //浅拷贝
    BRTest *test = self;
    test.name = [self.name copy];
    return test;
}

- (id)mutableCopyWithZone:(NSZone *)zone{
    //深拷贝
    BRTest *test = [[BRTest allocWithZone:zone] init];
    test.name = [self.name mutableCopy];
    return test;
}
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:self.name forKey:@"name"];
    
}
- (id)initWithCoder:(NSCoder *)aDecoder{
    _name=[aDecoder decodeObjectForKey:@"name"];
    return self;
    
}
@end
